London | JAN-ITP-26 | Kayanat Suleman | Sprint 3 | Alarm Clock App#969
London | JAN-ITP-26 | Kayanat Suleman | Sprint 3 | Alarm Clock App#969KayanatSuleman wants to merge 9 commits intoCodeYourFuture:mainfrom
Conversation
A-O-Emmanuel
left a comment
There was a problem hiding this comment.
Issues with your alarm clock app:
- When I click on the
set alarmbutton, the timer starts counting backwards. - When I click on the
set alarmbutton, without entrying anynumberin the input box, I don't get anyalertmessage, instead the timer just starts counting backwards. I should not be able to set an alarm on an empty input box. - Your input box accepts
negativenumbers, it should not.
Hi @A-O-Emmanuel Thank you for the review, I have made the necessary changes and the test are passing. |
| let value = input.value | ||
|
|
||
| if (value === "") { | ||
| return; |
There was a problem hiding this comment.
Instead of returning it will be better to show the user an appropriate message, can you think of a way to do that please.
There was a problem hiding this comment.
Hi @A-O-Emmanuel, thank you for the review comments. I have updated the validation so that if the input field is empty, the app now displays a user message ("Please enter a number of seconds.") instead of returning silently. This prevents the timer from starting without valid input.
| let remainingSeconds = Number(value); | ||
|
|
||
| if (remainingSeconds <= 0 || isNaN(remainingSeconds)) { | ||
| return; |
There was a problem hiding this comment.
Also instead of returning, it will be better you show the user an appropriate message, think of a way to do that.
There was a problem hiding this comment.
Thank you for the review comment. I have now updated the logic so that if the value is invalid (NaN) or less than or equal to zero, the app displays the message ("Please enter a positive number greater than 0.") rather than returning silently.
Learners, PR Template
Self checklist
Changelist